import React from 'react';
import ReactDOM from 'react-dom';

import {
  HashRouter as Router,
  Route,
  Switch,
  Redirect
} from './lib/router-router-dom';

const Home = (props) => {
  console.log(props)
  return (
    <div>
      Home
    </div>
  )
}
const Detail = (props) => {
  return (
    <div>
      Detail
    </div>
  )
}

const ActicleDetail = (props) => {
  console.log('props', props)
  return (
    <div>
      ActicleDetail
    </div>
  )
}

ReactDOM.render(
  <Router>
    <Switch>
      <Route exact={true} path="/" component={Home}/>
      <Route path="/detail" component={Detail}/>
      <Route path="/acticle/:id" exact={true} component={ActicleDetail}/>
      <Redirect to="/" />
    </Switch>
  </Router>,
  document.getElementById('root')
);

// 注意如果要使用老的把 jsx 编译成 React.createElement(), 必须在启动项中设置 cross-env DISABLE_NEW_JSX_TRANSFORM=true
// 如： "start": "cross-env DISABLE_NEW_JSX_TRANSFORM=true react-scripts start",